﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DefaultMaster.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="Templates_Bookings_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHeader" runat="Server">

    <acms:JavascriptFile ID="uiCoreMin" Path="~/script/ui.core.min.js" runat="server" />
    <acms:JavascriptFile ID="uiAccordianMin" Path="~/script/ui.accordion.min.js" runat="server" />
    <script type="text/javascript">
        $(document).ready(function() {
            var accoredianStateId = '<%= Request.IsAuthenticated ? ((HiddenField)loginView.FindControl("accordianState")).ClientID : "" %>';
            var accoredianId = '<%= Request.IsAuthenticated ? ((Panel)loginView.FindControl("accordian")).ClientID : "" %>';
            //- 0 to ensure varient is int not string
            if (accoredianStateId != "" && accoredianId != "") {
                var tmpActive = $("#" + accoredianStateId).val() - 0;
                $("#" + accoredianId).accordion({ active: tmpActive, change: function(e, ui) { $("#" + accoredianStateId).val($(ui.newHeader).prevAll().length / 2); } });
            }
        });
    </script>
    <acms:FlashContentControlDisplay ID="flashHeader" ControlName="FlashHeader" WMode="Transparent" MaxWidth="800" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="Server">
   <SCRIPT language="JavaScript">
       var axel = Math.random() + "";
       var a = axel * 10000000000000;
       document.write('<IFRAME SRC="http://fls.uk.doubleclick.net/activityi;src=1813552;type=brand683;cat=harle944;ord=' + a + '?" WIDTH=1 HEIGHT=1 FRAMEBORDER=0></IFRAME>');
</SCRIPT>
<NOSCRIPT>
<IFRAME SRC="http://fls.uk.doubleclick.net/activityi;src=1813552;type=brand683;cat=harle944;ord=1?" WIDTH=1 HEIGHT=1 FRAMEBORDER=0></IFRAME>
</NOSCRIPT>
        <acms:ImageContentControlDisplay ID="imageIntro" ControlName="ImageIntro" runat="server" />
       
        <asp:LoginView ID="loginView" runat="server">
            <LoggedInTemplate>
            <div class="htmlArticle"> 
                <asp:Panel ID="pnlBooked" CssClass="currentlyBooked" Visible='<%#CurrentBooking != null %>' runat="server">
                    You have currently booked
                        <asp:Label ID="lblSelected" runat="server"><%# CurrentBooking != null ? CurrentBooking.DateTime.ToString("ddd dd/MM/yyyy @ HH:mm") : "" %></asp:Label>
                </asp:Panel>
                
                <asp:HiddenField ID="accordianState" Value="0" runat="server" />
                
                    <asp:Panel ID="accordian" CssClass="moo" runat="server">
                    <acms:SimpleRepeater ID="rpt" DataSourceID="dsDates" runat="server">
                        <ItemTemplate>
                            <h3 class='<%#Container.DisplayIndex % 2 == 0 ? "h3Left" : "h3Right"%>'><%#Eval("Date", "{0:ddd dd MMM yyyy}") %></h3>
                            <div class='wrapper <%#Container.DisplayIndex % 2 == 0 ? "wrapperLeft" : "wrapperRight"%>'>
                                <div class="innerWrapper">
                                    <asp:ListView ID="listTimes" OnDataBinding="listTimes_DataBinding" OnItemDataBound="listTimes_ItemDataBound" OnItemCommand="listTimes_ItemCommand" GroupItemCount="4" runat="server" c>
                                        <LayoutTemplate>
                                                <asp:PlaceHolder ID="groupPlaceholder" runat="server" />
                                        </LayoutTemplate>
                                        
                                        <GroupTemplate>
                                            <div class="outer" style="width:24.9%;float:left;">
                                                <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
                                            </div>
                                        </GroupTemplate>
                                        
                                        <ItemTemplate>
                                            <asp:Panel CssClass="item" ID="pnlItem" runat="server">
                                                <asp:LinkButton ID="btnItem" Text='<%#Eval("DateTime", "{0:HH.mm}") %>' OnClientClick='<%#  Eval("DateTime", "javascript: return confirm(\"Are you sure you want to book a {0:HH.mm} appointment?\");")%>' CommandName="SelectDate"
                                                    CommandArgument='<%# Eval("Id") %>' runat="server" />
                                            </asp:Panel>
                                        </ItemTemplate>
                                    </asp:ListView>
                                    <div style="clear:both"></div>
                                </div>            
                            </div>
                        </ItemTemplate> 
                    </acms:SimpleRepeater>
                </asp:Panel>
                
                <acms:EventDrivenDataSource ID="dsDates" OnSelect="dsDates_Select" runat="server" />
                </div>
            </LoggedInTemplate>
            
            <AnonymousTemplate>
                <asp:HyperLink ID="lnkLogin" CssClass="needToLogIn" NavigateUrl='<%#string.Concat("~/Login.aspx?ReturnUrl=", HttpUtility.UrlEncode(AcmsContext.OriginalUrl)) %>' runat="server" />
            </AnonymousTemplate>
        </asp:LoginView>
        <div class="imgDiv">
            <asp:Image ID="imgPdf" ImageUrl="~/img/guidedownload.gif" runat="server" />
        </div>
        <asp:LoginView ID="viewDownload" runat="server">
            <AnonymousTemplate>
                <asp:HyperLink ID="lnkLogin" CssClass="needToLogIn" NavigateUrl='<%#string.Concat("~/Login.aspx?ReturnUrl=", HttpUtility.UrlEncode(AcmsContext.OriginalUrl)) %>' runat="server" />
            </AnonymousTemplate>
            <LoggedInTemplate>
                <asp:HyperLink ID="lnkDownload" Target="_blank" CssClass="clickHereDownload" NavigateUrl="~/BookingSite/download/GeanGeanie-StyleGuide.pdf" runat="server" />
            </LoggedInTemplate>
        </asp:LoginView>
</asp:Content>
